<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
         var str = `<span>9.7<span><span>-248人评价</span><br>
        <span>9.5<span><span>-48人评价</span>
        <br><span>9.6<span><span>-508人评价</span>`;
        /* 
        arr = [
            {star:9.7,rating:248},
            {star:9.5,rating:48},
            {star:9.6,rating:508},
        ]
         */
        var arr = str.split("<br>")
        var res = []
        arr.forEach(item=>{
            // console.log(item)
            // var list = item.replace(/<[^<>]+>/g,"").trim().split("-")
            var list = item.replace(/[^\d-.]/g,"").split("-")
            console.log(list)
            res.push({
                star:list[0],
                rating:list[1].replace(/[^\d]/g,"")
            })
           
        }) 
        console.log(res)
    </script>
</body>
</html>